home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: C constant expression declarations
- Date: 16 Feb 1996 18:47:42 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4g3fkeINNoj7@keats.ugrad.cs.ubc.ca>
- References: <31229735.41C67EA6@isi.com> <4fvl5cINN94q@keats.ugrad.cs.ubc.ca> <4g2nha$ksa@sun001.spd.dsccc.com>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <4g2nha$ksa@sun001.spd.dsccc.com>,
- Mike McCarty <jmccarty@spd.dsccc.com> wrote:
-
- >I respectfully disagree with this statement. It buys two very important
- >things, to wit:
- >
- > it builds a good habit of putting parens in, so that when they
- > are needed they don't inadvertently get left out
- >
- > it builds consistency, so that one gets a feeling that
- > "something may be wrong here" when inspecting code for
- > errors
- >
- >I believe that (for the sake of creating and maintaining correct
- >programs) these are well worth the extra discipline (at first) and
- >compilation time for the cases where the parens are not strictly needed.
-
- I put my extra discipline into consciously knowing what I'm doing. I _am_
- awake; I _did_ drink my coffee. I will not write things that don't _buy_
- anything. They obfuscate programs more than they help.
-
- Parentheses are intended to override operator precedence, and to occasionally
- make a complex expression clearer to someone reading them; a proverbial icing
- on the cake of sorts.
-
- if (x == 3 || y > 4 && z < 5)
-
- is easier to read than
-
- if ((x == 3) || ((y > 4) && (z < 5)))
-
-
- --
-
-